/*
 * 类名称:TaxInfoServiceImpl.java
 * 包名称:com.lht.admin.service.impl
 *
 * 修改履历:
 *     日期                       修正者        主要内容
 *     2020-01-02 01:17:11        ZhengZhanWu     初版做成
 */
package com.lht.admin.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lht.admin.dao.TaxInfoDao;
import com.lht.admin.entity.TaxInfoEntity;
import com.lht.admin.service.TaxInfoService;
import com.lht.admin.utils.QueryPlus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 企业申请税务信息Service实现类
 *
 * @author ZhengZhanWu
 * @date 2020-01-02 01:17:11
 */
@Service("taxInfoService")
public class TaxInfoServiceImpl extends ServiceImpl<TaxInfoDao, TaxInfoEntity> implements TaxInfoService {

    @Override
    public List<TaxInfoEntity> queryAll(Map<String, Object> params) {
        params.put("sidx", "T.year");
        params.put("asc", true);
        return baseMapper.queryAll(params);
    }

    @Override
    public Page queryPage(Map<String, Object> params) {
        //排序
        params.put("sidx", "T.id");
        params.put("asc", false);
        Page<TaxInfoEntity> page = new QueryPlus<TaxInfoEntity>(params).getPage();
        return page.setRecords(baseMapper.selectTaxInfoPage(page, params));
    }

    @Override
    public boolean add(TaxInfoEntity taxInfo) {
        return this.save(taxInfo);
    }

    @Override
    public boolean update(TaxInfoEntity taxInfo) {
        return this.updateById(taxInfo);
    }

    @Override
    public boolean delete(Long id) {
        return this.removeById(id);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteBatch(Long[] ids) {
        return this.removeByIds(Arrays.asList(ids));
    }
}
